package com.beichen.controller;

import com.beichen.domain.Enterprise;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.env.Environment;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RequestMapping
@RestController
public class BookConctroller {

    @Autowired
    private Environment env;

    @Autowired
    private Enterprise enterprise;

    @Value("${lesson}")
    private String lesson;

    @Value("${enterprise.name}")
    private String name;

    @Value("${enterprise.subject[2]}")
    private String subject;
    @GetMapping("/books")
    public String selctAll(){
        System.out.println("select all in controller");
        System.out.println(lesson);
        System.out.println(name);
        System.out.println(subject);
        System.out.println(env.getProperty("lesson"));
        System.out.println(env.getProperty("enterprise.name"));
        System.out.println(env.getProperty("enterprise.tel"));
        System.out.println(env.getProperty("enterprise.subject[1]"));
        System.out.println(enterprise.toString());
        return "select all";
    }
}
